package com.diors.game.engine.arpg.scene.model;

/**
 * 地图代码点的功能枚举
 * @author	darren.ouyang <ouyang.darren@gmail.com>
 * @date	2013-10-22
 * @version 1.0
 * @copyright Copyright (c) 2013, darren.ouyang
 */
public enum MapPoint 
{
	WAY		(0, "O", "道路"),
	BLOCK	(1, "X", "档格"),
	CLIFF	(2, "F", "悬崖"),
	BOG		(3, "B", "沼泽");
	
	private int id;
	private String code;
	private String info;
	
	MapPoint(int id, String code, String info)
	{
		this.id = id;
		this.code = code;
		this.info = info;
	}

	public int getId() {
		return id;
	}

	public String getCode() {
		return code;
	}

	public String getInfo() {
		return info;
	}
	
	private static MapPoint getTypeByCode (final String code)
	{
		if (code.equals("O"))
			return MapPoint.WAY;
		else if (code.equals("X"))
			return MapPoint.BLOCK;
		else if (code.equals("F"))
			return MapPoint.CLIFF;
		else if (code.equals("B"))
			return MapPoint.BOG;
		
		return MapPoint.BLOCK;
	}
	
	public static int getIdByCode (String code)
	{
		return getTypeByCode(code).getId();
	}
}
